using System.ComponentModel;
using System.IO;
using ClickOnceMaster.Common;
using ClickOnceMaster.WizardConfiguration;

namespace ClickOnceMaster
{
    internal static class WizardContext
    {
        #region Instance properties

        /// <summary>
        /// List of file for manifest.
        /// </summary>
        public static BindingList<ManifestFile> Files
        {
            get; set;
        }

        public static DirectoryInfo SourceDirectory
        {
            get; set;
        }

        #endregion

        #region .ctors

        static WizardContext()
        {
            ResetContext();

            WizardSettings.Current.Manifest.SourceFilesPathChanged += ManifestPathChanged;
        }

        #endregion

        #region Instance methods

        #region Event handlers

        /// <summary>
        /// Handle the <see cref="ManifestSettings.SourceFilesPathChanged"/> event.
        /// </summary>
        private static void ManifestPathChanged(object sender, System.EventArgs e)
        {
            ResetContext();
        }

        #endregion

        #region Auxiliary methods

        /// <summary>
        /// Restes the current conext.
        /// </summary>
        private static void ResetContext()
        {
            Files = new BindingList<ManifestFile>();
        }

        #endregion

        #endregion
    }
}